<html><!-- Created using the cpp_pretty_printer from the dlib C++ library.  See http://dlib.net for updates. --><head><title>dlib C++ Library - sync_extension_kernel_1.h</title></head><body bgcolor='white'><pre>
<font color='#009900'>// Copyright (C) 2003  Davis E. King (davis@dlib.net)
</font><font color='#009900'>// License: Boost Software License   See LICENSE.txt for the full license.
</font><font color='#0000FF'>#ifndef</font> DLIB_SYNC_EXTENSION_KERNEl_1_
<font color='#0000FF'>#define</font> DLIB_SYNC_EXTENSION_KERNEl_1_

<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../threads.h.html'>../threads.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='../algs.h.html'>../algs.h</a>"
<font color='#0000FF'>#include</font> "<a style='text-decoration:none' href='sync_extension_kernel_abstract.h.html'>sync_extension_kernel_abstract.h</a>"

<font color='#0000FF'>namespace</font> dlib
<b>{</b>

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> base
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>class</font> <b><a name='sync_extension_kernel_1'></a>sync_extension_kernel_1</b> : <font color='#0000FF'>public</font> base
    <b>{</b>

        rmutex m;
        rsignaler s;

        <font color='#0000FF'>public</font>:

        <b><a name='sync_extension_kernel_1'></a>sync_extension_kernel_1</b> <font face='Lucida Console'>(</font><font face='Lucida Console'>)</font> : s<font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font> <b>{</b><b>}</b>

        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font> <font color='#0000FF'>typename</font> T <font color='#5555FF'>&gt;</font>
        <b><a name='sync_extension_kernel_1'></a>sync_extension_kernel_1</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> one<font face='Lucida Console'>)</font> : base<font face='Lucida Console'>(</font>one<font face='Lucida Console'>)</font>,s<font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font> <b>{</b><b>}</b>
        <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font> <font color='#0000FF'>typename</font> T, <font color='#0000FF'>typename</font> U <font color='#5555FF'>&gt;</font>
        <b><a name='sync_extension_kernel_1'></a>sync_extension_kernel_1</b> <font face='Lucida Console'>(</font><font color='#0000FF'>const</font> T<font color='#5555FF'>&amp;</font> one, <font color='#0000FF'>const</font> U<font color='#5555FF'>&amp;</font> two<font face='Lucida Console'>)</font> : base<font face='Lucida Console'>(</font>one,two<font face='Lucida Console'>)</font>,s<font face='Lucida Console'>(</font>m<font face='Lucida Console'>)</font> <b>{</b><b>}</b>


        <font color='#0000FF'>const</font> rmutex<font color='#5555FF'>&amp;</font> <b><a name='get_mutex'></a>get_mutex</b><font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> m; <b>}</b>

        <font color='#0000FF'><u>void</u></font> <b><a name='lock'></a>lock</b> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> m.<font color='#BB00BB'>lock</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>

        <font color='#0000FF'><u>void</u></font> <b><a name='unlock'></a>unlock</b> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> m.<font color='#BB00BB'>unlock</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>

        <font color='#0000FF'><u>void</u></font> <b><a name='wait'></a>wait</b> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> s.<font color='#BB00BB'>wait</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>

        <font color='#0000FF'><u>bool</u></font> <b><a name='wait_or_timeout'></a>wait_or_timeout</b> <font face='Lucida Console'>(</font>
            <font color='#0000FF'><u>unsigned</u></font> <font color='#0000FF'><u>long</u></font> milliseconds
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> <font color='#0000FF'>return</font> s.<font color='#BB00BB'>wait_or_timeout</font><font face='Lucida Console'>(</font>milliseconds<font face='Lucida Console'>)</font>; <b>}</b>
         
        <font color='#0000FF'><u>void</u></font> <b><a name='broadcast'></a>broadcast</b> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> s.<font color='#BB00BB'>broadcast</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>

        <font color='#0000FF'><u>void</u></font> <b><a name='signal'></a>signal</b> <font face='Lucida Console'>(</font>
        <font face='Lucida Console'>)</font> <font color='#0000FF'>const</font> <b>{</b> s.<font color='#BB00BB'>signal</font><font face='Lucida Console'>(</font><font face='Lucida Console'>)</font>; <b>}</b>

    <b>}</b>;

    <font color='#0000FF'>template</font> <font color='#5555FF'>&lt;</font>
        <font color='#0000FF'>typename</font> base
        <font color='#5555FF'>&gt;</font>
    <font color='#0000FF'>inline</font> <font color='#0000FF'><u>void</u></font> <b><a name='swap'></a>swap</b> <font face='Lucida Console'>(</font>
        sync_extension_kernel_1<font color='#5555FF'>&lt;</font>base<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> a, 
        sync_extension_kernel_1<font color='#5555FF'>&lt;</font>base<font color='#5555FF'>&gt;</font><font color='#5555FF'>&amp;</font> b 
    <font face='Lucida Console'>)</font> <b>{</b> a.<font color='#BB00BB'>swap</font><font face='Lucida Console'>(</font>b<font face='Lucida Console'>)</font>; <b>}</b>

<b>}</b>

<font color='#0000FF'>#endif</font> <font color='#009900'>// DLIB_SYNC_EXTENSION_KERNEl_1_
</font>

</pre></body></html>